import { http } from './service.js'
//添加相册
export const addAlbum = (params) => {
	return http.request({
		url: '/pad/photo_album/album',
		method: 'POST',
		params: params
	})
}
export const getAlbum = (params) => {
	return http.request({
		url: '/pad/photo_album/album',
		method: 'GET',
		params: params
	})
}
//查询相册
export const getAlbums = (params) => {
	return http.request({
		url: '/pad/photo_album/albums_by_class_children',
		method: 'GET',
		params
	})
}
//删除相册
export const delAlbum = (params) => {
	return http.request({
		url: '/pad/photo_album/album',
		method: 'DELETE',
		params
	})
}
export const updateAlbum = (albumId, cover) => {
	return http.request({
		url: '/pad/photo_album/album',
		method: 'POST',
		params: {
			'albumId': albumId,
			'cover': cover,
		}
	})
}

//上传相册照片
export const uploadAlbumPhoto = (formData, filePath) => {
	return http.upload('/pad/photo_album/upload' ,{
		formData: formData,
		filePath: filePath,
		name: 'files'
	})
}
//查询相册照片
export const getAlbumPhoto = (params) => {
	return http.request({
		url: '/pad/photo_album/photos',
		method: 'GET',
		params
	})
}
//删除相册照片
export const delAlbumPhoto = (albumId, photoIds) => {
	return http.request({
		url: '/pad/photo_album/photo',
		method: 'DELETE',
		params: {
			'albumId': albumId,
			'photoIds': photoIds,
		}
	})
}


export const getAlbumTemplates = () => {
	return http.request({
		url: '/api/static_photo_album/album_templates',
		method: 'GET'
	})
}

export const getAlbumTemplatePage = (templateId) => {
	return http.request({
		url: '/api/static_photo_album/album_template_pages',
		method: 'GET',
		params: {
			templateId
		}
	})
}

export const createAlbumTemplate = (data) => {
	return http.request({
		url: '/api/static_photo_album/create',
		method: 'POST',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		},
		data
	})
}

export const requestPrintAlbumTemplate = (params) => {
	return http.request({
		url: '/api/static_photo_album/request_print',
		method: 'GET',
		params
	})
}


export const getChildrenPhoto = (params) => {
	return http.request({
		url: '/web/photo_album/photos',
		method: 'GET',
		params
	})
}